import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import million from 'million/compiler'
import { createSWCTransformDepsPlugin } from "@preact-signals/safe-react/integrations/vite";
import LightningCSS from 'unplugin-lightningcss/vite'


// https://vitejs.dev/config/
export default defineConfig({
  define: {
    'process.env': {}
  },
  resolve: {
    alias: [
      // if some lib uses signals it's probably using `@preact/signals-react`
      {
        find: "@preact/signals-react",
        replacement: "@preact-signals/safe-react",
      },
    ],
  },
  plugins: [
    createSWCTransformDepsPlugin({
      filter: (id) => id.includes("node_modules"),
    }),
    react({
      plugins: [["@preact-signals/safe-react/swc", {}]],
    }),
    LightningCSS(),
    million.vite({auto:true}),
  ],
})
